<template>
  <div>
    <div class="title">
      <h1>日排放量</h1>
    </div>
    <div class="content">
      <el-form ref="form" :model="form" label-width="200px">
        <el-col :span="8"><div class="grid-content bg-purple">排入水中的化学物质</div></el-col>
        <br>
        <br>
        <el-form-item label="排放量：" style="width: 600px;font-size: 8ex" prop="waterPfl"
                      :rules="[
            {required: true, message: '排放量不能为空',trigger: 'blur' }
          ]">
          <el-input v-model="form.waterPfl" style="width: 100%;" placeholder="请输入内容(0~1范围内)" :disabled="true">
          </el-input>
        </el-form-item>
        <el-col :span="8"><div class="grid-content bg-purple">排入大气中的化学物质</div></el-col>
        <br>
        <br>

        <el-form-item label="排放量：" style="width: 600px;font-size: 8ex" prop="airPfl"
                      :rules="[
            {required: true, message: '排放量不能为空',trigger: 'blur' }
          ]">
          <el-input v-model="form.airPfl" style="width: 100%;" placeholder="请输入内容(0~1范围内)" :disabled="true">
          </el-input>
        </el-form-item>

        <el-col :span="8"><div class="grid-content bg-purple">排入土壤中的化学物质</div></el-col>
        <br>
        <br>

        <el-form-item label="排放量：" style="width: 600px;font-size: 8ex" prop="soilPfl"
                      :rules="[
            {required: true, message: '排放量不能为空',trigger: 'blur' }
          ]">
          <el-input v-model="form.soilPfl" style="width: 100%;" placeholder="请输入内容(0~1范围内)" :disabled="true">
          </el-input>
        </el-form-item>

      </el-form>
      <br>
      <br>
      <br>
      <el-button style="margin-top: 12px;" @click="goBack">上一步</el-button>
      <el-button style="margin-top: 12px;" @click="sendDailyEmissions">提交</el-button>

    </div>

  </div>

</template>

<script>
  import DirectUsage from "./UsageParameters/DirectUsage";
  import IndirectUsage from "./UsageParameters/IndirectUsage";
  import BaseInformation from "./BaseInformation";
  export default {
    name: "DailyEmissions",
    data(){
      return {
        form:{
          waterPfl: "",
          airPfl: "",
          soilPfl: "",
        },
        waterFunctionPath: '',
        airFunctionPath: '',
        soilFunctionPath: '',
        evaluate: {},
      }
    },
    watch:{
          'form.waterPfl':function () {
              this.form.waterPfl = parseFloat(this.form.waterPfl).toFixed(6);
          },
          'form.airPfl':function () {
              this.form.airPfl = parseFloat(this.form.airPfl).toFixed(6);
          },
          'form.soilPfl':function () {
              this.form.soilPfl = parseFloat(this.form.soilPfl).toFixed(6);
          }

      },
    methods:{
      goBack(){
        this.$emit('goBack');
      },
      setPfl(){
        console.log("float",parseFloat('0.00675'));
        this.evaluate = this.$store.getters.getEvaluate;
        console.log("this.evaluate:",this.evaluate);
        if(this.evaluate.faWzlb==='基础化学品'){
          if(this.evaluate.faClgy==='预处理'){
            if(this.evaluate.zjWzyl){
              this.form.waterPfl = (parseFloat(this.evaluate.zjWzyl) * (1-parseFloat(this.evaluate.fixation)) + parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.yjbz)) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.airPfl = parseFloat(this.evaluate.zjWzyl) * parseFloat(this.evaluate.airPfxs) * (1-parseFloat(this.evaluate.airFwcs));
              this.form.soilPfl = parseFloat(this.evaluate.zjWzyl) * parseFloat(this.evaluate.soilPfxs);
              this.waterFunctionPath = 'function_1.png';
              this.airFunctionPath = 'function_7.png';
              this.soilFunctionPath = 'function_9.png';
            }
            else{
              this.form.waterPfl = (parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * (1-parseFloat(this.evaluate.fixation)) + parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.yjbz)) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.airPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.airPfxs) * (1-parseFloat(this.evaluate.airFwcs));
              this.form.soilPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.soilPfxs);
              this.waterFunctionPath = 'function_2.png';
              this.airFunctionPath = 'function_8.png';
              this.soilFunctionPath = 'function_10.png';
            }
          }
        }
        else if(this.evaluate.faWzlb==='染料'){
          if(this.evaluate.faClgy==='浸染染色'){
            if(this.evaluate.zjWzyl){
              this.form.waterPfl = (parseFloat(this.evaluate.zjWzyl) * (1-parseFloat(this.evaluate.fixation))) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.airPfl = parseFloat(this.evaluate.zjWzyl) * parseFloat(this.evaluate.airPfxs) * (1-parseFloat(this.evaluate.airFwcs));
              this.form.soilPfl = parseFloat(this.evaluate.zjWzyl) * parseFloat(this.evaluate.soilPfxs);
              this.waterFunctionPath = 'function_3.png';
              this.airFunctionPath = 'function_7.png';
              this.soilFunctionPath = 'function_9.png';
            }
            else{
              this.form.waterPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * (1-parseFloat(this.evaluate.fixation)) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.airPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.airPfxs) * (1-parseFloat(this.evaluate.airFwcs));
              this.form.soilPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.soilPfxs);
              this.waterFunctionPath = 'function_4.png';
              this.airFunctionPath = 'function_8.png';
              this.soilFunctionPath = 'function_10.png';
            }
          }
          else if(this.evaluate.faClgy==='浸轧染色'){
            if(this.evaluate.zjWzyl){
              let temp = (parseFloat(this.evaluate.zjWzyl) * (1-parseFloat(this.evaluate.fixation)) + parseFloat(this.evaluate.zjWzyl) * parseFloat(this.evaluate.residualLiquor)) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.waterPfl = temp;
              this.form.waterPfl = (parseFloat(this.evaluate.zjWzyl) * (1-parseFloat(this.evaluate.fixation)) + parseFloat(this.evaluate.zjWzyl) * parseFloat(this.evaluate.residualLiquor)) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.airPfl = parseFloat(this.evaluate.zjWzyl) * (1-parseFloat(this.evaluate.airPfxs)) * (1-parseFloat(this.evaluate.airFwcs));
              this.form.soilPfl = parseFloat(this.evaluate.zjWzyl) * (1-parseFloat(this.evaluate.soilPfxs));
              this.waterFunctionPath = 'function_5.png';
              this.airFunctionPath = 'function_7.png';
              this.soilFunctionPath = 'function_9.png';
            }
            else{
              this.form.waterPfl = ((parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * (1-parseFloat(this.evaluate.fixation))) + parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.residualLiquor)) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.airPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.airPfxs) * (1-parseFloat(this.evaluate.airFwcs));
              this.form.soilPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.soilPfxs);
              this.waterFunctionPath = 'function_6.png';
              this.airFunctionPath = 'function_8.png';
              this.soilFunctionPath = 'function_10.png';
            }
          }
        }
        else{
          if(this.evaluate.faClgy==='预处理'){
            if(this.evaluate.zjWzyl){
              this.form.waterPfl = (parseFloat(this.evaluate.zjWzyl) * (1-parseFloat(this.evaluate.fixation)) + parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.yjbz)) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.airPfl = parseFloat(this.evaluate.zjWzyl) * parseFloat(this.evaluate.airPfxs) * (1-parseFloat(this.evaluate.airFwcs));
              this.form.soilPfl = parseFloat(this.evaluate.zjWzyl) * parseFloat(this.evaluate.soilPfxs);
              this.waterFunctionPath = 'function_1.png';
              this.airFunctionPath = 'function_7.png';
              this.soilFunctionPath = 'function_9.png';
            }
            else{
              this.form.waterPfl = (parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * (1-parseFloat(this.evaluate.fixation)) + parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.yjbz)) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.airPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.airPfxs) * (1-parseFloat(this.evaluate.airFwcs));
              this.form.soilPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.soilPfxs);
              this.waterFunctionPath = 'function_2.png';
              this.airFunctionPath = 'function_8.png';
              this.soilFunctionPath = 'function_10.png';
            }
          }
          else if(this.evaluate.faClgy==='浸染染色'){
            if(this.evaluate.zjWzyl){
              this.form.waterPfl = (parseFloat(this.evaluate.zjWzyl) * (1-parseFloat(this.evaluate.fixation))) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.airPfl = parseFloat(this.evaluate.zjWzyl) * (1-parseFloat(this.evaluate.airPfxs)) * (1-parseFloat(this.evaluate.airFwcs));
              this.form.soilPfl = parseFloat(this.evaluate.zjWzyl) * (1-parseFloat(this.evaluate.soilPfxs));
              this.waterFunctionPath = 'function_3.png';
              this.airFunctionPath = 'function_7.png';
              this.soilFunctionPath = 'function_9.png';
            }
            else{
              this.form.waterPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.airPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.airPfxs) * (1-parseFloat(this.evaluate.airFwcs));
              this.form.soilPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.soilPfxs);
              this.waterFunctionPath = 'function_4.png';
              this.airFunctionPath = 'function_8.png';
              this.soilFunctionPath = 'function_10.png';
            }
          }
          else{
            if(this.evaluate.zjWzyl){
              console.log(2)
              console.log("this.evaluate.zjWzyl",this.evaluate.zjWzyl);
              let temp = (parseFloat(this.evaluate.zjWzyl) * (1-parseFloat(this.evaluate.fixation)) + parseFloat(this.evaluate.zjWzyl) * parseFloat(this.evaluate.residualLiquor)) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.waterPfl = temp;
              //this.form.waterPfl = (parseFloat(this.evaluate.zjWzyl) * (1-parseFloat(this.evaluate.fixation)) + parseFloat(this.evaluate.zjWzyl) * parseFloat(this.evaluate.residualLiquor)) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.airPfl = parseFloat(this.evaluate.zjWzyl) * parseFloat(this.evaluate.airPfxs) * (1.0-parseFloat(this.evaluate.airFwcs));
              this.form.soilPfl = parseFloat(this.evaluate.zjWzyl) * parseFloat(this.evaluate.soilPfxs);
              this.waterFunctionPath = 'function_5.png';
              this.airFunctionPath = 'function_7.png';
              this.soilFunctionPath = 'function_9.png';
            }
            else{
              console.log("this.evaluate.jjFzpbl",this.evaluate.jjFzpbl);
              this.form.waterPfl = (parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * (1-parseFloat(this.evaluate.fixation)) + parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.residualLiquor)) * (1-parseFloat(this.evaluate.waterFwcs));
              this.form.airPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.airPfxs) * (1-parseFloat(this.evaluate.airFwcs));
              this.form.soilPfl = parseFloat(this.evaluate.jjFzpl) * parseFloat(this.evaluate.jjYjl) * parseFloat(this.evaluate.jjYxcfhl) * parseFloat(this.evaluate.jjFzpbl) * parseFloat(this.evaluate.soilPfxs);
              this.waterFunctionPath = 'function_6.png';
              this.airFunctionPath = 'function_8.png';
              this.soilFunctionPath = 'function_10.png';
            }
          }
        }
      },
      sendDailyEmissions() {
        if (this.form.waterPfl != '') {
          if (this.form.airPfl != '') {
            if (this.form.soilPfl != '') {
              //let flag = {flag: '1'};
              let dailyEmissions = {waterPfl: this.form.waterPfl, airPfl: this.form.airPfl, soilPfl: this.form.soilPfl,waterFunctionPath:this.waterFunctionPath,airFunctionPath: this.airFunctionPath,soilFunctionPath :this.soilFunctionPath}
              this.$store.commit("setDailyEmissions", dailyEmissions)
              this.$emit('listenChild');
            } else {
              this.$message("废渣排放量不能为空")
            }
          } else {
            this.$message("废气排放量不能为空")
          }
        } else {
          this.$message("废水排放量不能为空")
        }
      },


  },
    components:{
      DirectUsage,
      IndirectUsage,

    }
  }
</script>

<style scoped lang="scss">
  .title{
    position:absolute;
    left:0px;
  }
  .content{
    position:absolute;
    top:100px;
    left:20%;
    right:25%;
    .font{
      font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;

    }
  }

</style>



